<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery-3.6.0.js"></script>
</head>
<body>
<input type="button" id="btn" value="发送异步" >
</body>

<script>
    $(function(){
        $("#btn").click(function(){
            // $.get("jsonDemo",function (obt) {
            //     console.log(obt)
            //     //console.log(obt.name)
            // },"json");
            $.ajax({
                url:"jsonDemo",
                success:function (obt) {
                    console.log(obt)
                    //输出显示obt中所有属性值
                    $(obt).each(function(i,dom){
                        console.log(dom.id,dom.name,dom.age)
                    })
                },
                dataType:"json",
                error:function(xhr,a,b){
                    console.log(a,b)

                }
            })
        })
    })
</script>
</html>